<#macro header title keywords>
<!DOCTYPE html>
<html lang="en">

<head>
    <title>专业化评价预警工具 - ${title!}</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="${keywords!}"
    <meta name="description" content="">
    <meta name="author" content="alangyun.com">
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="${ROOT}/mind/images/favicon.png">
    <!-- drop zone -->
    <link rel="stylesheet" href="${ROOT}/mind/css/lib/dropzone/dropzone.css">
    <link rel="stylesheet" href="${ROOT}/mind/css/lib/bootstrap/bootstrap.min.css">
    <link rel="stylesheet" href="${ROOT}/mind/css/lib/sweetalert/sweetalert.css">
    <link rel="stylesheet" href="${ROOT}/mind/css/lib/toastr/toastr.min.css">
    <link rel="stylesheet" href="${ROOT}/mind/css/lib/treeview/bootstrap-treeview.min.css">
    <!-- Custom CSS -->
    <link rel="stylesheet" href="${ROOT}/mind/css/style.css">
    <link rel="stylesheet" href="${ROOT}/mind/css/custom-style.css">

    <#nested>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
    }

    html {
        height: 100%;
    }

    body {
        height: 100%;
    }

    #loginDiv {
        width: 100%;
        height: 100%;
        position: fixed;
        left: 0;
        top: 0;
        z-index: 999;
        display: none;
        background-image: linear-gradient(135deg, #2a9d8f, #264653);
    }

    #changeWrapper {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 999;
        background-image: linear-gradient(to right, #fbc2e1, #a6c1e1);
    }
</style>

</#macro>
<#macro body>
<body class="header-fix fix-sidebar">
<!-- Main wrapper  -->
<div id="loginDiv">
    <#include "login.html"/>
    <#include "register.html"/>
    <#include "delete-user.html"/>
    <#include "modification.html"/>
</div>
<div id="main-wrapper">
    <!-- header header  -->
    <#include "part-header.html"/>
    <!-- End header header -->
    <!-- Left Sidebar  -->
    <#include "part-category.html"/>
    <!-- End Left Sidebar  -->
    <!-- Page wrapper  -->
    <div class="page-wrapper">
        <#nested>
        <!-- footer -->
        <#include "part-footer.html"/>
        <!-- End footer -->
    </div>
    <!-- End Page wrapper  -->
</div>

<!-- End Wrapper -->
</#macro>

<#macro footer>
<!-- All Jquery -->
<script type="text/javascript" src="${ROOT}/mind/js/lib/jquery/jquery.min.js"></script>
<!-- format -->
<script type="text/javascript" src="${ROOT}/mind/js/lib/format/jquery.formatter.js"></script>
<!-- Bootstrap -->
<script type="text/javascript" src="${ROOT}/mind/js/lib/bootstrap/js/popper.min.js"></script>
<script type="text/javascript" src="${ROOT}/mind/js/lib/bootstrap/js/bootstrap.min.js"></script>
<!-- slimscrollbar scrollbar JavaScript -->
<script type="text/javascript" src="${ROOT}/mind/js/jquery.slimscroll.js"></script>
<!--Menu sidebar -->
<script type="text/javascript" src="${ROOT}/mind/js/sidebarmenu.js"></script>
<!--stickey kit -->
<script type="text/javascript" src="${ROOT}/mind/js/lib/sticky-kit-master/dist/sticky-kit.min.js"></script>

<!--Custom JavaScript -->
<script type="text/javascript" src="${ROOT}/mind/js/lib/webticker/jquery.webticker.min.js"></script>
<script type="text/javascript" src="${ROOT}/mind/js/lib/dropzone/dropzone.js"></script>
<script type="text/javascript" src="${ROOT}/mind/js/lib/sweetalert/sweetalert.min.js"></script>
<script type="text/javascript" src="${ROOT}/mind/js/lib/toastr/toastr.min.js"></script>
<script type="text/javascript" src="${ROOT}/mind/js/lib/moment/moment.js"></script>
<script type="text/javascript" src="${ROOT}/mind/js/lib/form-validation/jquery-form-editor.js"></script>
<script type="text/javascript" src="${ROOT}/mind/js/lib/treeview/bootstrap-treeview.min.js"></script>
<script type="text/javascript" src="${ROOT}/mind/js/lib/html2canvas/html2canvas.min.js"></script>
<script type="text/javascript" src="${ROOT}/mind/js/lib/jspdf/jspdf.umd.min.js"></script>
<script type="text/javascript">
    window.jsPDF = window.jspdf.jsPDF;
</script>
<script type="text/javascript" src="${ROOT}/mind/js/lib/jspdf/fangsong-normal.js"></script>
<script type="text/javascript" src="${ROOT}/mind/js/plugins/alangyun-pdfcanvas.js"></script>
<#nested>
<!-- scripit init-->
<script type="text/javascript" src="${ROOT}/mind/js/custom.js"></script>
<script type="text/javascript" src="${ROOT}/mind/js/custom-remind.js"></script>
<script>
    window.addEventListener('message', function(event) {
        if(event.data) {
            document.getElementById('loginDiv').style.display = 'none'
        }

    });
</script>
<script>
    // window.addEventListener('beforeunload',()=>{
    //     sessionStorage.clear()
    // })
    checkLoginState()

    var Permissions = []
    function updateMenu () {
        var menu1 = document.getElementById('menu1');
        var menu2 = document.getElementById('menu2');
        var menu3 = document.getElementById('menu3');
        var menu4 = document.getElementById('menu4');
        // 首先隐藏所有菜单
        menu1.style.display = 'none';
        menu2.style.display = 'none';
        menu3.style.display = 'none';
        menu4.style.display = 'none';

        // 根据权限显示相应的菜单
        if (Permissions.includes('1')) {
            menu1.style.display = '';
        }
        if (Permissions.includes('2')) {
            menu2.style.display = '';
        }
        if (Permissions.includes('3')) {
            menu3.style.display = '';
        }
        if (Permissions.includes('4')) {
            menu4.style.display = '';
        }
        if (Permissions[0] == 9) {
            menu1.style.display = '';
            menu2.style.display = '';
            menu3.style.display = '';
            menu4.style.display = '';
        }
    }
    window.addEventListener('message', function(event) {
        Permissions = event.data
        if (!Array.isArray(Permissions)) {
            Permissions = [Permissions]; // 确保 Permissions 始终是一个数组
        }
        updateMenu()
    });

    function checkLoginState(){
        var isLoggedIn = sessionStorage.getItem('isLoggedIn')
        if(isLoggedIn) {
            document.getElementById('loginDiv').style.display = 'none'
            Permissions = sessionStorage.getItem('userPermissions')
            updateMenu()
        } else {
            document.getElementById('loginDiv').style.display = 'block'
        }
    }
</script>

</body>

</html>
</#macro>